<?php


namespace app\common\logic;
use app\common\model\Verification as VerificationModel;
use app\common\service\Qrcode;

class Verification extends Base
{
    public function recombine($data){
        if (empty($data['id'])){
            $verification = new VerificationModel();
            $verification->verification_name = $data['verification_name'];
            $verification->save();
            $qrcode = Qrcode::generateQrcode(request()->domain()."/mob/#/pages/ticket/bind?id=".$verification->id);
            $value['id'] = $verification->id;
            $value['code'] = $qrcode;
        }else{
            $value['id'] = $data['id'];
            $value['verification_name'] = $data['verification_name'];
        }
        return $value;
    }
}